package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.ArchiveReportInfo;
import com.sl.au.entity.EventRegister;
import com.sl.au.entity.EventReport;

public interface ArchiveReportInfoRepository extends JpaRepository<ArchiveReportInfo, String> {

	ArchiveReportInfo getByReport(EventReport eventReport);

	@Query("select a from ArchiveReportInfo a where a.archiver.name like %?1% or a.content like %?1% or a.memo like %?1%")
	Page<ArchiveReportInfo> initArchivedPageByKey(String key, Pageable pageable);

	@Query("select a from ArchiveReportInfo a")
	Page<ArchiveReportInfo> initArchivedPageNoKey(Pageable pageable);

	@Query("select a from EventRegister a where a.registerEventToReportEvent.id=?1")
	Page<EventRegister> showDetailRegisters(String reportId, Pageable pageable);

}
